#!/bin/bash -x
USERNAME=spruce
PASSWORD=spruce
DVN_SERVER=localhost:8181
if [ -z "$1" ]; then
  GLOBAL_ID=`scripts/api/data-deposit/list-datasets | xpath '//id/text()' | cut -d'/' -f11,12,13`
else
  GLOBAL_ID=$1
  #GLOBAL_ID=doi:10.5072/FK2/17
fi
#curl --insecure -X DELETE https://$DVN_SERVER/api/datasets/$DATABASE_ID?key=$USERNAME
curl --insecure -i -X DELETE -u $USERNAME:$PASSWORD https://$DVN_SERVER/dvn/api/data-deposit/v1/swordv2/edit/study/$GLOBAL_ID
#| xmllint -format -
